package com.example.work_study_system.web.controller;


import com.example.work_study_system.model.domain.Feedback;
import com.example.work_study_system.service.FeedbackService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/api/feedback")
public class FeedbackController {
    @Autowired
    private FeedbackService feedbackService;

    @GetMapping("/list")
    public List<Feedback> list() {
        return feedbackService.list();
    }

    @GetMapping("/{id}")
    public Feedback getById(@PathVariable Integer id) {
        return feedbackService.getById(id);
    }

    @PostMapping("/add")
    public boolean add(@RequestBody Feedback feedback) {
        return feedbackService.save(feedback);
    }

    @PutMapping("/update")
    public boolean update(@RequestBody Feedback feedback) {
        return feedbackService.updateById(feedback);
    }

    @DeleteMapping("/delete/{id}")
    public boolean delete(@PathVariable Integer id) {
        return feedbackService.removeById(id);
    }
} 